package com.example.droideep.fragment.check;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.CompoundButton;
import android.widget.TextView;

/**
 * @author bri
 * @date 15-6-11.
 */
public class CheckButton extends TextView implements Checkable {

    private boolean isChecked;

    public CheckButton(Context context) {
        super(context);
    }

    public CheckButton(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CheckButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void setChecked(boolean checked) {
        if (isChecked != checked) {
            isChecked = checked;

        }
    }

    @Override
    public boolean isChecked() {
        return isChecked;
    }

    @Override
    public void toggle() {
        setChecked(!isChecked());
    }
}
